package com.sgcc.pda.hzaidl.impl;

import com.sgcc.pda.hzaidl.AIDLServiceImpl;
import com.sgcc.pda.hzaidl.IHZAidlCallback;
import com.sgcc.pda.hzaidl.entity.AuthorResult;
import com.sgcc.pda.hzaidl.entity.RequestBean;
import com.sgcc.pda.hzaidl.entity.ResponseBean;
import com.sgcc.pda.tools.JsonUtils;
import com.sgcc.pda.util.PlatConstant;
import com.sgcc.platforminterface.PlatfInterfManager;

import java.util.ArrayList;
import java.util.List;


/**
 * 描 述：业务服务
 * 作 者：wxl  2020/8/31 10:52
 * 修改描述： XXX
 * 修 改 人： XXX  2020/8/31 10:52
 * 修改版本： XXX
 */
public class BusinessUtil {

    private static AIDLServiceImpl getBusinessManager() {
        return AIDLServiceImpl.getInstance();
    }
    public static List<AuthorResult> requestData(String methodName) {
        RequestBean requestBean = new RequestBean(PlatConstant.IWebCmd.BUSINESS, methodName, "", PlatfInterfManager.getInstance().getPackageName(), "");
        String result=getBusinessManager().post(requestBean.toString(), null);
        ResponseBean responseBean = JsonUtils.toBean(result, ResponseBean.class);
        if (responseBean != null && responseBean.getRetCode() == 1) {
            return JsonUtils.toList(responseBean.getMsgJson(), AuthorResult.class);
        }
        return null;
    }
    public static void requestData(String methodName, String paramJson, IHZAidlCallback.Stub stub) {
        RequestBean requestBean = new RequestBean(PlatConstant.IWebCmd.BUSINESS, methodName, paramJson, PlatfInterfManager.getInstance().getPackageName(), "");
        getBusinessManager().post(requestBean.toString(), stub);
    }
}
